# -*- coding: utf-8 -*-
# @Time:2021/04/19 22:25
# @Author:Cindy
from time import sleep
from selenium.webdriver.common.by import By
from pages.base_page import BasePage


class AddDepartment(BasePage):

    def add_department(self, dapartname):

        from pages.contact_page import Contact

        # 查找“部门名称”下的输入框，输入内容
        self.driver.find_element(By.CSS_SELECTOR, ".ww_inputText:nth-child(2)").send_keys(dapartname)
        # 点击“所属部门”下的下拉框，进行选择
        self.driver.find_element(By.CSS_SELECTOR, ".ww_btn_Dropdown:nth-child(2)").click()
        self.driver.find_element(By.CSS_SELECTOR, '.ww_dialog [id="1688850000885137_anchor"]').click()
        sleep(3)
        # 点击“确定”按钮
        self.driver.find_element(By.CSS_SELECTOR, ".ww_dialog_foot>a:nth-child(1)").click()
        sleep(5)
        return Contact(self.driver)
